<div ng-controller="Director_PurchasingDetailC">
    <div class="bg-light lter b-b wrapper-md">
        <h1 class="m-n font-thin h3">入库采购单详情</h1>
    </div>
    <div class="wrapper-md">
        <div class="panel panel-default">
            <div class="table-responsive">
                <form name="form" class="form-validation">
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="form-group">
                                <label>供应商</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.Provider.Name}}">
                            </div>
                            <div class="form-group">
                                <label>收货仓库</label>
                                <input type="text" class="form-control" readonly="readonly" value="{{orderdetaildata.ToDepot.Name}}">
                            </div>
                            <div class="form-group">
                                <label  for="suojia" style="margin-right: 10px;">货款是否标件</label>
                                <label class="i-checks">
                                    <input type="checkbox" id="suojia" ng-model="orderdetaildata.IsStandard" disabled>
                                    <i></i>
                                </label>
                                <label for="zipai" style="margin-right: 10px;" ng-click="zipai()">运费是否标件</label>
                                <label class="i-checks" ng-click="zipai()"  >
                                    <input type="checkbox" id="zipai" ng-model="orderdetaildata.IsPublicDelivery" disabled>
                                    <i></i>
                                </label>
                            </div>
                            <div class="form-group">
                                <label>每吨运费</label>
                                <input type="text" class="form-control" readonly="readonly" ng-model="orderdetaildata.DeliveryPrice">
                            </div>
                            <div class="form-group">
                                <label>联系人信息</label>
                                <input type="text" class="form-control" readonly="readonly" ng-model="orderdetaildata.Contact">
                            </div>
                            <div class="form-group">
                                <label>备注</label>
                                <input type="text" class="form-control" readonly="readonly" ng-model="orderdetaildata.Remarks">
                            </div>
                            <div class="form-group">
                                <label>创建人：</label>
                                <span>{{orderdetaildata.Creater.Name}}</span>
                            </div>
                            <!--<div class="form-group">-->
                            <!--<label>变更记录：</label>-->
                            <!--<ul>-->
                            <!--<li ng-repeat="item in orderdetaildata.Records">-->
                            <!--<label ng-if="item.Price != 0">{{item.Price}}/</label>{{item.Remarks}}/{{item.CreateTime}}-->
                            <!--</li>-->
                            <!--</ul>-->
                            <!--</div>-->
                            <div class="form-group">
                                <label>采购单状态：</label>
                                <span ng-if="orderdetaildata.State == 0">待确认</span>
                                <span ng-if="orderdetaildata.State == 1">审批中</span>
                                <span ng-if="orderdetaildata.State == 2">采购中</span>
                                <span ng-if="orderdetaildata.State == 3">取消</span>
                                <span ng-if="orderdetaildata.State == 4">完成采购</span>
                                <span ng-if="orderdetaildata.State == 5">入库审批</span>
                                <span ng-if="orderdetaildata.State == 6">已入库</span>
                                <span ng-if="orderdetaildata.State == 7">已发货</span>
                            </div>
                        </div>
                        <div class="container-fluid text-center bg-light lter" >
                            <div class="row">
                                <h3 style="display: inline-block;margin: 0 auto">采购单商品列表</h3>
                            </div>
                        </div>
                        <div class="container-fluid">
                            <div class="panel panel-default" ng-repeat="item in orderdetaildata.Goodses" style="margin-bottom: 10px">
                                <div class="panel-heading">
                                    <div>品牌：{{item.Commodity.Brand}}</div>
                                </div>
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-xs-12 col-md-12">
                                            <div>名称/材质/规格：{{item.Commodity.Name}}/{{item.Commodity.Standard}}/{{item.Commodity.Format}}</div>
                                            <div>单价：{{item.Price | number:2}}/t</div>
                                            <div>数量：{{item.Count | number:2}}</div>
                                            <div>总质量：{{item.Weight | number:2}}t</div>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel-footer">
                                    <div>总价：{{item.Price | number:2}}*{{item.Weight | number:3}}t={{item.Price*item.Weight | number:2}}</div>
                                </div>
                            </div>
                            <div class="row text-left">
                                <h4 style="display: inline-block">总价：{{orderdetaildata.Total | number:2}}</h4>
                            </div>
                            <div class="row text-left">
                                <h4 style="display: inline-block">预计运费价格：{{orderdetaildata.DeliveryPriceTotal | number:2}}</h4>
                            </div>
                            <div class="row text-right">
                                <button type="button" class="btn btn-success" ng-click="goorderList()">返回采购单列表</button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    angular.module('app')
            //采购单详情控制器
            .controller("Director_PurchasingDetailC", function ($scope, $state, $stateParams, $http) {
                $scope.id = JSON.parse($stateParams.orderid);
                //获取采购单详细数据
                $http({
                    url: "../api/Purchase/" + $scope.id,
                    method: "GET"
                })
                        .then(function (res) {
                            $scope.orderdetaildata = res.data;
                            console.log($scope.orderdetaildata);
                        })
                        .then(function (error) {
                            if (error) {
                                console.log("error");
                            }
                        });
                //返回计划单列表
                $scope.goorderList = function () {
                    $state.go('app.Purchasing_Director');
                };
            })
</script>